#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN=1e7+10;
int n,pri[MAXN],phi[MAXN],tot;
LL ans,pre[MAXN];
bool ispri[MAXN];
void cal_prime_phi()
{
    phi[1]=1;
    for(int i=2;i<MAXN;++i)
    {
        if(!ispri[i])
        {
            pri[++tot]=i;
            phi[i]=i-1;
        }
        for(int j=1;j<=tot&&i*pri[j]<=MAXN;++j)
        {
            ispri[i*pri[j]]=true;
            if(!(i%pri[j]))
            {
                phi[i*pri[j]]=phi[i]*pri[j];
                break;
            }
            else phi[i*pri[j]]=phi[i]*(pri[j]-1);
        }
    }
    return;
}
int main()
{
    scanf("%d",&n);
    cal_prime_phi();
    for(int i=1;i<=n;++i)pre[i]=pre[i-1]+phi[i];
    for(int i=2;i<=n;++i)
    {
    	if(ispri[i])continue;
    	ans+=pre[n/i]*2-1;
	}
    printf("%lld\n",ans);
    return 0;
}
